<template>
  <div class="question-card">
    <div class="question-card__header">{{ data.createTime }}</div>
    <div class="question-card__body">
      <info-item label="咨询" :value="data.title" />
      <info-item v-if="data.answer" label="回复" :value="data.answer" />
    </div>
  </div>
</template>

<script>
import InfoItem from '@/components/InfoItem.vue'
export default {
  components: {
    InfoItem
  },
  props: {
    data: {
      type: Object,
      required: true
    }
  }
}
</script>

<style lang="less">
.question-card {
  background-color: #ffffff;
  &__header {
    height: 128px;
    display: flex;
    align-items: center;
    position: relative;
    font-size: 32px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #222222;
    line-height: 46px;
    padding: 0 40px;
    box-shadow: inset 0 -2px 0 0 #f5f5f5;

    &::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 0;
      transform: translateY(-50%);
      height: 32px;
      width: 8px;
      background-color: @primary;
      border-radius: 0 8px 8px 0;
    }
  }

  &__body {
    padding: 40px;
    .info-item + .info-item {
      margin-top: 32px;
    }

    .info-item {
      justify-content: start;
      align-items: flex-start;
      &__label {
        flex-shrink: 0;
        width: 80px;

        &::after {
          content: ':';
        }
      }
    }
  }
}
</style>
